﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;

namespace ValidationFramework.Web.MVC.Tests
{
	[TestFixture]
	public class ClientValidationEngineTests
	{
		[Test]
		public void Should_Leverage_Dependencies_And_Use_Them_As_Expected()
		{
			//// Arrange | Mock Extractor
			//var extractor = MockRepository.GenerateMock<IRuleExtractor>();
			//var propertyRules = new List<RuleInfo>() { new RuleInfo() };
			//extractor.Expect(x => x.Extract()).Return(propertyRules);

			//// Arrange | Mock Converter
			//var converter = MockRepository.GenerateMock<IRuleConverter>();
			//new KeyValuePair<string, IList<ClientRule>>("test", new List<ClientRule>());
			//var converterResult = new ElementRuleDictionary();
			//converterResult.Add("TestElement", new List<IClientRule>() { 
			//    new ClientRule { ErrorMessage = "test error", ClientFunctionCall = new ClientFunctionCall() { FunctionName = "TestFunction" } }
			//});
			//converter.Stub(x => x.ConvertToElementRuleDictionary(null))
			//    .IgnoreArguments()
			//    .Return(converterResult);

			//// Arrange | Mock Generator
			//var generator = MockRepository.GenerateMock<IClientValidationGenerator>();

			//// Act
			//var engine = new ClientValidationEngine(extractor, generator, converter);
			//var result = engine.GenerateScript("testForm");

			//// Assert
			//converter.AssertWasCalled(x => x.ConvertToElementRuleDictionary(propertyRules));
			//generator.AssertWasCalled(x => x.Generate("testForm", converterResult));
		}
	}
}
